package com.xb.p3_style;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class EventActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_event);

         Button btn = findViewById(R.id.btn_show);
//         btn.setOnClickListener(new myOnclickListener());
        btn.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v) {
                TextView tv = findViewById(R.id.tv_show);
                tv.setText(R.string.newString);
                EventActivity.this.setTitle("新标题内容");
            }
        });
    }

    public class myOnclickListener implements View.OnClickListener{
        @Override
        public void onClick(View v) {
            TextView tv = findViewById(R.id.tv_show);
            tv.setText(R.string.newString);
            EventActivity.this.setTitle("新标题内容");
        }
    }
    /*public void changeText(View view){
        TextView tv = findViewById(R.id.tv_show);
        tv.setText(R.string.newString);
        this.setTitle("新标题内容");
    }*/
}
